#!/bin/sh

> tmp$$
cat CompositeStocks|sort |uniq |while read stock
do
    #resp=`curl -stderr "http://www.stoxline.com/quote.php?s=$stock" |egrep "color=blue|color=red|color=green"`
    resp=`curl -stderr "http://www.stoxline.com/quote.php?s=$stock" |egrep -o "[1-5]s.bmp" |sed 's/s.bmp//g'`
    buysell=`echo $resp |sed -e 's/1/Strong Sell/g' -e 's/2/Sell/g'  -e 's/4/Neutral/g' -e 's/3/Buy/g' -e 's/5/Strong Buy/g'` 
    echo $stock $buysell >> tmp$$
done

cat tmp$$ |grep -i "Strong Buy" |awk '{print $1}' > StoxlineLongList
cat tmp$$ |grep -i "Sell" |awk '{print $1}' > StoxlineShortList
